//
// Created on 2024/7/31.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be
// found, please include "napi/native_api.h".

#ifndef ARKUI_C_API_NATIVEMODULE_H
#define ARKUI_C_API_NATIVEMODULE_H

#include <arkui/native_interface.h>
#include <arkui/native_node.h>
#include <cassert>

namespace NativeModule {

class NativeModuleInstance {
    ArkUI_NativeNodeAPI_1 *arkUI_NativeNodeAPI_ = nullptr;

public:
    static NativeModuleInstance *getInstance() {
        static NativeModuleInstance instance;
        return &instance;
    }

    NativeModuleInstance() {
        OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, arkUI_NativeNodeAPI_);
        assert(arkUI_NativeNodeAPI_);
    }

    ArkUI_NativeNodeAPI_1 *GetNativeNodeAPI() { return arkUI_NativeNodeAPI_; }
};

}; // namespace NativeModule

#endif // ARKUI_C_API_NATIVEMODULE_H
